﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Utils;

namespace Logic
{
    public class Administradores : Personas
    {
        private Data.Administradores _hnd_administradores = new Data.Administradores();

        private Data.Administradores HndAdministradores
        {
            get { return _hnd_administradores; }
        }

        public Entities.Administrador GetByLegajo(int legajo)
        {
            return HndAdministradores.GetByLegajo(legajo);
        }

        public Entities.Collections.AdministradoresCollection GetCollection()
        {
            return HndAdministradores.GetCollection();
        }

        private string Validate(Entities.Administrador instance)
        {
            return base.Validate(instance).ToString();
        }

        public string Save(Entities.Administrador instance)
        {
            string r = Validate(instance);

            if (r.IsEmptyString())
            {
                instance.Nombre = instance.Nombre.Trim();
                instance.Apellido = instance.Apellido.Trim();
                instance.Direccion = instance.Direccion.Trim();
                instance.Telefono = instance.Telefono.Trim();
                instance.Email = instance.Email.Trim();
                HndAdministradores.Save(instance);
            }

            return r;
        }
    }
}
